package cn.webrx;

import java.util.Scanner;

public class Excep5 {
    public static void main(String[] args) {
        boolean f = false;
        do {
            try {
                Scanner sc = new Scanner(System.in);
                System.out.print("\n请输入数字a");
                // java.util.InputMismatchException
                int a = sc.nextInt();
                System.out.print("\n请输入数字b");
                int b = sc.nextInt();
                // java.lang.ArithmeticException
                System.out.printf("%d / %d = %d \n", a, b, a / b);
                f = false;
            } catch (Exception e) {
                System.out.println("\n输入有误，必须都输入数字，且第二个b不能输入0.");
                f = true;
            }
        }while(f);
        System.out.println("谢谢使用");
    }
}
